<?php echo $this->doctype()?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php echo $this->headTitle()?>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<?php echo $this->headMeta();?>
	<link type="text/css" rel="stylesheet" href="<?php echo PUBLIC_URL."/skins/default/css/base.css";?>"/>
	<link type="text/css" rel="stylesheet" href="<?php echo PUBLIC_URL."/skins/default/css/home.css";?>"/>
	<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/jquery.js";?>"></script>
	<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/base.js";?>"></script>
	<?php echo $this->headLink();?>
	<?php echo $this->headScript();?>
	<script type="text/javascript">
	$(document).ready(function(){
		var img;
		var width;
		$("#man_menu > ul > li").hover(
			function(){
				width = $(this).width();
				img = $(this).find("img");
				img.width(width);
			},
			
			function(){
				$(this).width(width);
				img.width(width * 95/100);

			}
		);
		$("#hotline .btnClose").click(function(){
		if($("#hotline").hasClass("closed")){
			$("#hotline").removeClass("closed");
		}else{
			$("#hotline").addClass("closed");
		}
		});
		$("#man_menu li ul li:first-child a").hover(
				function(){
					$(".angle").css("background-position", "top right");
					
				},
				function(){
					$(".angle").css("background-position", "top left");
				}
		);
		checkVersion();
		
	});
	function getInternetExplorerVersion()
	// Returns the version of Internet Explorer or a -1
	// (indicating the use of another browser).
	{
	  var rv = -1; // Return value assumes failure.
	  if (navigator.appName == 'Microsoft Internet Explorer'){
		var ua = navigator.userAgent;
		var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if (re.exec(ua) != null)
			rv = parseFloat( RegExp.$1 );
		}
		return rv;
	}
	function checkVersion()
	{
	  var msg = "";
	  var ver = getInternetExplorerVersion();

	  if ( ver > -1 )
	  {
		if ( ver < 7.0 ){ 
		  msg = "Website không hỗ trợ cho trình duyệt Internet Explorer "+ver+ " .\nBạn nên nâng cấp trình duyệt của mình.";
		  alert( msg );
		}
	  }
	 
	}
	</script>
</head>

<body>
<div id="wrapper">
	<div id="header">
    	<div id="top_menu">        	
            	<ul id="top_menu_link">
                	<?php
                		
                		foreach ($this->menu as $menu){
                			echo "<li><a href='".$menu->link."'>".$menu->name."</a></li>";
                		}
                	?>
                </ul>          
            <span id="date">
            	<?php
            	$date = gmdate(" l d-m-Y ");
            	if(strstr( $date, "Monday")) $date = str_replace("Monday", "Thứ Hai", $date);
            	if(strstr( $date, "Tuesday")) $date = str_replace("Tuesday", "Thứ Ba", $date);
            	if(strstr($date ,"Wednesday" )) $date = str_replace("Wednesday", "Thứ Tư", $date);
            	if(strstr( $date,"Thursday")) $date = str_replace("Thursday", "Thứ Năm", $date);
            	if(strstr($date, "Friday")) $date = str_replace("Friday", "Thứ Sáu", $date);
            	if(strstr($date, "Saturday")) $date = str_replace("Saturday", "Thứ Bảy", $date);
            	if(strstr($date,"Sunday" )) $date = str_replace("Sunday", "Chủ Nhật", $date);
            	echo $date;
            	?>
            </span>
        </div><!-- end top_menu block -->
    	<div id="head_banner">
    		<div id="logo">
    			<img src="<?php echo PUBLIC_URL."/skins/default";?>/images/logo_banner.jpg" />
    		</div>
    		<div id="banner">
    			<?php Helper_HtmlRender::renderImageOrFlash($this->banners[0]->image, 735, 110, 'Thiết Bị văn phòng Cường Phú - Design by IDG');?>
    		</div>
    		
    	</div><!--end head_banner block-->
        <div id="man_menu">
        	<ul>
        	<?php
        	$countMan = count($this->mans);
            $i = 0;
        	foreach ($this->mans as $man){
        		$i++;
				
        	?>
        	<li <?php echo ($i == $countMan) ? "class='last'" : ""?>>
        		<a href="<?php echo $this->url(array("man_name"=> $man->name, "page" => ""), "man");?>">
        			<img src="<?php echo $man->logo;?>" alt="<?php echo $man->name;?>" />
        		</a>
        		<?php
        		$manCategories = $man->findManyToManyRowset("Model_PCategory", "Model_ManCat");
        		if(count($manCategories) > 0){
        			echo "<div class='angle'></div>";
	        		echo "<ul>";?>
	        		
	        		<?php 
	        		foreach ($manCategories as $manCategory){
	        			echo "<li><a href='".$this->url(array(
	        										"man_name"=> $man->name, 
	        										"cat_slug"=> $manCategory->slug,
	        										"page" => ""
	        										), "man_pcategory")."'>".$manCategory->name."</a></li>";
	        		}
	        		echo "</ul>";
        		}
        		?>
        		
        	</li>
        	<?php
        	} 
        	?>
            	
            </ul>
        </div><!-- end man_menu block -->
        <div id="cat_menu">
        	<ul>
            	<li ><a href="<?php echo $this->url(array(), "default");?>" > <img src="<?php echo PUBLIC_URL."/skins/default";?>/images/home_logo.png" width="20px" height="20px"/>Trang chủ</a></li>
            	<?php
            	$count = count($this->pCategories);
            	
            	for ($i = 0; $i < $count; $i++){
            		if($i >0 && $this->pCategories[$i-1]->level < $this->pCategories[$i]->level  ){
            			echo "<ul>";
            				
            		}
            		echo "<li".(($i == $count -1) ? " class='last'" : "") ."><a href='".$this->url(array("page" => "", "cat_name"=> Helper_Converter::stringToSlug($this->pCategories[$i]->slug), "cat_id" => $this->pCategories[$i]->id),"pcategory")."'>".$this->pCategories[$i]->name."</a>";
            		if($this->pCategories[$i+1]->level < $this->pCategories[$i]->level && $i < $count){
            			echo "</ul>";
            		}
            	}
            	?>
                
                	
            </ul>
           
        </div><!-- end cat_menu block -->
    </div><!-- end header block-->
    
    <div id="content">
    	
    		<?php
    		
    		echo $this->layout()->content;?>
    	
    </div><!--end content block-->
    
    <div id="footer">
        <div id="left_footer">
        	<div id="mini_logo"><img src="<?php echo PUBLIC_URL."/skins/default";?>/images/mini_logo.png" /></div>
            <div id="text_info">
            	CÔNG TY CỔ PHẦN CÔNG NGHỆ CƯỜNG PHÚ <BR />
                <b>[ VPGD ] </b>Số 138, Vương Thừa Vũ, P.Khương Trung Thanh Xuân, HN<br />
                <b>[ MST ] </b>0105319266<br />
                <b>[Điện thoại] </b>: 0466.84.87.86 * Fax : 04.35.68.33.27 <br />
                <a href="<?php echo $this->url(array("slug" => $this->mapPage->slug), "post");?>"><b>[Bản đồ đường đi]</b></a>
            </div>
        </div><!--end left_footer block-->
    	<div id="right_footer"> 
        	<div class="link_info">
            	<div class="title_link_info"><b>THÔNG TIN CƯỜNG PHÚ</b></div>
            	
                <div class="text_link">
                	<ul>
                    	<?php foreach($this->info_cps as $info_cp){?>
                    	 	<li><a href="<?php echo $this->url(array('slug'=>$info_cp->slug),'post');?>"><?php echo "&gt;".$info_cp->title;?></a></li>
                         <?php }?>                       
                    </ul>
                </div>
            </div>
           	<div class="link_info">
            	<div class="title_link_info"><b>TRỢ GIÚP MUA HÀNG</b></div>
                <div class="text_link">
                	<ul>
                    	<?php foreach($this->help_purchases as $help_purchase){	?>
                    	 	<li><a href="<?php echo $this->url(array('slug' => $help_purchase->slug),'post');?>"><?php echo "&gt;".$help_purchase->title;?></a></li>
                         <?php }?>   
                    </ul>
                </div>
            </div>
          	<div class="link_info">
            	<div class="title_link_info"><b>CHÍNH SÁCH CHUNG</b></div>
                <div class="text_link">
                	<ul>
	                	<?php foreach($this->policies as $policy){	?>
                    	 	<li><a href="<?php echo $this->url(array('slug' => $policy->slug),'post');?>"><?php echo "&gt;".$policy->title;?></a></li>
                         <?php }?>   
	                </ul>
                </div>
            </div>
        </div><!-- end right_footer block-->
		<div id="bottom_footer"> Copyright © 2010 - 2011 CUONGPHU. Develop by <a href="http://idgit.com.vn">IDGIT</a>. All Rights Reserved.  </div><!--end bottom_footer block-->
    </div><!-- end footer block-->  
    <?php if( isset($this->banners[7])){?>
<div id="hotline">
	<div class="hl-title">
		<span>Mua hàng online</span>
		<div class="btnClose"></div>
	</div>
	<div class="hl-image">
		<?php echo Helper_HtmlRender::renderImageOrFlash($this->banners[7]->image, 300, null, $this->banners[4]->link);?>
	</div>
</div>

<?php } ?>
</div>

</body>
</html>